package com.qhhc.hospital.service.impl;

import com.qhhc.hospital.entity.Drug;
import com.qhhc.hospital.mapper.DrugMapper;
import com.qhhc.hospital.service.IDrugService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DrugService implements IDrugService {
    @Autowired
    DrugMapper drugMapper;
    
    @Override
    public int insert(Drug drug) {
        int count = drugMapper.insertDrug(drug);
        return count;
    }
    
    @Override
    public List<Drug> selectAll() {
        List<Drug> drugs = drugMapper.selectAllDrugs();
        return drugs;
    }
    
    @Override
    public Drug selectById(Integer drId) {
        Drug drug = drugMapper.selectDrugById(drId);
        return drug;
    }
    
    @Override
    public int update(Drug drug) {
        return drugMapper.updateDrug(drug);
    }
    
    @Override
    public int delete(Integer drId) {
        return drugMapper.deleteDrug(drId);
    }
}